package com.youdianstar.app.common.skin

import android.view.View
import android.widget.ImageView
import android.widget.TextView




/**
 * File: SkinHelperEx
 * Author: 82149 Create: 2022/4/22 11:28
 * Changes (from 2022/4/22)
 * --------------------------------------------------
 * description:
 * ---------------------------------------------------
 *
 */
class SkinHelperEx {
    companion object {
        val instance by lazy { SkinHelperEx() }
    }

    fun setSkinConfig(view:View,skinConfig: ConfigEx){
//        val builder = QMUISkinValueBuilder.acquire()
//        if (skinConfig.textColor != 0) {
//            builder.textColor(skinConfig.textColor)
//        }
//        if (skinConfig.hintColor != 0) {
//            builder.hintColor(skinConfig.hintColor)
//        }
//        if (skinConfig.background != 0) {
//            builder.background(skinConfig.background)
//        }
//        if (skinConfig.iconRes != 0) {
//            builder.src(skinConfig.iconRes)
//        }
//        if (skinConfig.alpha != 0) {
//            builder.src(skinConfig.alpha)
//        }
//        QMUISkinHelper.setSkinValue(view, builder)
//        builder.release()
    }
}

fun View.setSkinBackground(attr:Int){
//    val builder = QMUISkinValueBuilder.acquire()
//    builder.background(attr)
//    QMUISkinHelper.setSkinValue(this, builder)
//    QMUISkinValueBuilder.release(builder)
}

fun TextView.setSkinTextColor(attrColor:Int,attrHint:Int?=0){
//    val builder = QMUISkinValueBuilder.acquire()
//    builder.textColor(attrColor)
//    attrHint?.let { builder.hintColor(it) }
//    QMUISkinHelper.setSkinValue(this, builder)
//    QMUISkinValueBuilder.release(builder)
}

fun ImageView.setSkinImageSrc(attr:Int){
//    val builder = QMUISkinValueBuilder.acquire()
//    builder.src(attr)
//    QMUISkinHelper.setSkinValue(this, builder)
//    QMUISkinValueBuilder.release(builder)
}

fun ImageView.setSkinSrcAndBg(srcId:Int,bgId:Int){
//    val builder = QMUISkinValueBuilder.acquire()
//    builder.background(bgId)
//    builder.src(srcId)
//    QMUISkinHelper.setSkinValue(this, builder)
//    QMUISkinValueBuilder.release(builder)
}
